home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / librw / RWTPtrMultiMapIterator.z / RWTPtrMultiMapIterator
Encoding:
Text File  |  2002-10-03  |  7.7 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTPtrMultiMapIterator<K,T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tpmmap.h>
  13.  
  14.  
  15.  
  16.               RWTPtrMultiMap<K,T,C> map;
  17.           RWTPtrMultiMapIterator<K,T,C> itr(map);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  24.      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr is supplied with Tools 7 to provide an iterator
  25.      interface to the new Standard Library based collections with backward
  26.      compatibility to the Tools 6 container iterators.  The order of iteration
  27.      over an RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaapppp is dependent on the comparator object of the
  28.      container as applied to the key values of the stored associations.  The
  29.      current item referenced by this iterator is undefined after construction
  30.      or after a call to rrrreeeesssseeeetttt(((()))).  The iterator becomes valid after being
  31.      advanced with either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++
  32.      and ooooppppeeeerrrraaaattttoooorrrr(((()))), iterating past the last element will return a value
  33.      equivalent to boolean ffffaaaallllsssseeee.  Continued increments will return a value
  34.      equivalent to ffffaaaallllsssseeee until rrrreeeesssseeeetttt(((()))) is called.
  35.  
  36. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  37.      None
  38.  
  39. EEEExxxxaaaammmmpppplllleeeessss
  40.               #include<rw/tpmmap.h>
  41.  
  42.  
  43.  
  44.               #include<iostream.h>
  45.           #include<rw/cstring.h>
  46.           #include<utility>
  47.  
  48.  
  49.               int main(){
  50.  
  51.  
  52.  
  53.                  RWTPtrMultiMap<RWCString,int,less<RWCString> > age;
  54.              RWTPtrMultiMapIterator<RWCString,int,less<RWCString> > itr(age);
  55.  
  56.  
  57.                  age.insert(new RWCString("John"), new int(30));
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.                  age.insert(new RWCString("Steve"),new int(17));
  75.              age.insert(new RWCString("Mark"), new int(24));
  76.              age.insert(new RWCString("Steve"),new int(24));
  77.  
  78.  
  79.                  for(;itr();)
  80.  
  81.  
  82.  
  83.                    cout << *itr.key() << "'s age is " << *itr.value() << endl;
  84.  
  85.  
  86.  
  87.                  return 0;
  88.  
  89.  
  90.  
  91.               }
  92.           Program Output
  93.           John's age is 30
  94.           Mark's age is 24
  95.           Steve's age is 17
  96.           Steve's age is 24
  97.  
  98. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  99.               RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr<<<<KKKK,,,,TTTT,,,,CCCC>>>>(const RWTPtrMultiMap<K,T,C>& m);
  100.  
  101.  
  102.      Creates an iterator for the multimap mmmm.  The iterator begins in an
  103.      undefined state and must be advanced before the first element will be
  104.      accessible
  105.  
  106. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  107.               K*
  108.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  109.  
  110.  
  111.      Advances self to the next element, dereferences the resulting iterator
  112.      and returns its key.  If the iterator has advanced past the last item in
  113.      the container,  the element returned will be a nnnniiiillll pointer equivalent to
  114.      boolean ffffaaaallllsssseeee.
  115.  
  116.               RWBoolean
  117.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  118.  
  119.  
  120.      Advances self to the next element.  If the iterator has been reset or
  121.      just created self will now reference the first element.  If, before
  122.      iteration, self referenced the last association in the multimap, self
  123.      will now point to an undefined value and a value equivalent to ffffaaaallllsssseeee will
  124.      be returned.  Otherwise, a value equivalent to ttttrrrruuuueeee is returned. Note: no
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      post-increment operator is provided.
  141.  
  142. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  143.               RWTPtrMultiMap<K,T,C>*
  144.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  145.  
  146.  
  147.      Returns a pointer to the collection being iterated over.
  148.  
  149.               K*
  150.           kkkkeeeeyyyy() const;
  151.  
  152.  
  153.      Returns the key portion of the association currently referenced by sssseeeellllffff.
  154.      Undefined if self is not referencing a value within the multimap.
  155.  
  156.               void
  157.           rrrreeeesssseeeetttt();
  158.           void
  159.           rrrreeeesssseeeetttt(RWTPtrMultiMap<K,T,C>& h);
  160.  
  161.  
  162.      Resets the iterator so that after being advanced it will reference the
  163.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  164.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTPPPPttttrrrrMMMMuuuullllttttiiiiMMMMaaaapppp
  165.      to rrrreeeesssseeeetttt(((()))) will reset the iterator on that container.
  166.  
  167.               T*
  168.           vvvvaaaalllluuuueeee();
  169.  
  170.  
  171.      Returns the value portion of the association referenced by sssseeeellllffff.
  172.      Undefined if self is not referencing a value within the multimap.
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.